package com.ziyun.pop.mall.module.time.listener;

import com.ziyun.pop.mall.module.time.task.UserActionTask;
import lombok.extern.slf4j.Slf4j;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.context.event.ContextClosedEvent;
import org.springframework.context.event.EventListener;
import org.springframework.stereotype.Component;

/**
 * 监听关服事件
 *
 * @Author:chenxiaoyi
 * @Date:2018/11/8 15:11
 */
@Slf4j
@Component
public class UserActionEventListener {

    @Autowired
    UserActionTask userActionTask;

    @EventListener(classes = ContextClosedEvent.class)
    public void handlerUserActionEvent(){
        log.info("用户行为记录关服监听回调  event [{}] = [{}]");
        userActionTask.executeUserActionTask();
    }

}
